
let app = getApp()
Component({
  data: {
    ossImg: `${app.globalData.imgUrl}/applet_web_images/new_image`,
  },
  props: {
    authorizeHide: false // 授权弹窗
  },
  methods: {
    handleGetPhone() {
      const app = getApp()
      app.getUserPhone(({data: res}) => {
        const { status, data } = res
        if(status === '1001' ) {
          const { 
            onHideAuthorize, 
            onSetPhoneState
          } = this.props
          onHideAuthorize()
  
          if(typeof onSetPhoneState === 'function') { // 设置手机号
            onSetPhoneState(data)
          }
        }
      })
    },
    // 关闭授权
    closeAuthorize() {
      this.props.onHideAuthorize()
    }
  }
})